package com.jwsoft.manager.core.gateway.controller;

import com.bifang.engine.protect.core.annotation.Crypto;
import com.bifang.engine.protect.core.annotation.NoSignCrypto;
import com.jwsoft.manager.core.integration.EduBusiEnrollOrderIntegration;
import com.jwsoft.manager.common.vo.eduBusiEnrollOrder.EduBusiEnrollOrderVO;
import com.jwsoft.manager.common.vo.eduBusiEnrollOrder.EduBusiEnrollOrderKeyVO;
import com.jwsoft.manager.common.vo.eduBusiEnrollOrder.EduBusiEnrollOrderQueryVO;
import com.github.pagehelper.PageInfo;
import com.bifang.engine.assistant.core.domain.AppResponse;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Operation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
import com.bifang.engine.protect.core.annotation.Idempotent;
import org.springframework.validation.annotation.Validated;
import com.bifang.assistant.common.constants.Validators;

/**
 * 报名派号业务管理网关
 *
 * @author zhiyuan
 * @since 2023-07-21
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "报名派号业务管理", description = "报名派号业务管理")
public class EduBusiEnrollOrderController {

    @Autowired
    public EduBusiEnrollOrderIntegration eduBusiEnrollOrderIntegration;

    @Operation(summary = "报名派号业务管理分页查询",description = "报名派号业务管理分页查询")
    @PostMapping(value = "/busiEnrollOrder0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduBusiEnrollOrderVO>> getList(@RequestBody @Validated EduBusiEnrollOrderQueryVO vo) {
        return AppResponse.successData(eduBusiEnrollOrderIntegration.getList(vo));
    }

    @Operation(summary = "报名派号业务管理根据主键查询详情",description = "报名派号业务管理根据主键查询详情")
    @PostMapping(value = "/busiEnrollOrder0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBusiEnrollOrderVO> getById(@RequestBody @Validated EduBusiEnrollOrderKeyVO vo) {
        return AppResponse.successData(eduBusiEnrollOrderIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "报名派号业务管理新增",description = "报名派号业务管理新增")
    @PostMapping(value = "/busiEnrollOrder0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBusiEnrollOrderVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduBusiEnrollOrderVO vo) {
        return AppResponse.successData(eduBusiEnrollOrderIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "报名派号业务管理修改",description = "报名派号业务管理修改")
    @PostMapping(value = "/busiEnrollOrder0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBusiEnrollOrderVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduBusiEnrollOrderVO vo) {
        return AppResponse.successData(eduBusiEnrollOrderIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "报名派号业务管理删除",description = "报名派号业务管理删除")
    @PostMapping(value = "/busiEnrollOrder0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduBusiEnrollOrderKeyVO vo) {
        eduBusiEnrollOrderIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "报名派号业务叫号",description = "报名派号业务叫号")
    @PostMapping(value = "/busiEnrollOrder0007", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBusiEnrollOrderVO>  callOrderNum(@RequestBody @Validated EduBusiEnrollOrderQueryVO vo) {
        return AppResponse.successData(eduBusiEnrollOrderIntegration.callOrderNum(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "家长APP请求派号",description = "报名派号业务叫号")
    @PostMapping(value = "/busiEnrollOrder0008", produces = "application/json;charset=UTF-8")
    public AppResponse<EduBusiEnrollOrderVO>  appDistributeOrderNum(@RequestBody @Validated EduBusiEnrollOrderQueryVO vo) {

        return AppResponse.successMsg(eduBusiEnrollOrderIntegration.appDistributeOrderNum(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "根据派号类型得到详情信息",description = "报名派号业务叫号")
    @PostMapping(value = "/busiEnrollOrder0009", produces = "application/json;charset=UTF-8")
    public AppResponse  getDetailsByOrderType(@RequestBody @Validated EduBusiEnrollOrderQueryVO vo) {
        return AppResponse.successData(eduBusiEnrollOrderIntegration.getDetailsByOrderType(vo));
    }

    @Operation(summary = "app报名派号业务管理根据身份证查询详情",description = "app报名派号业务管理根据身份证查询详情")
    @PostMapping(value = "/busiEnrollOrder0010", produces = "application/json;charset=UTF-8")
    @Crypto
    public AppResponse<EduBusiEnrollOrderVO> appGetById(@RequestBody @Validated EduBusiEnrollOrderQueryVO vo) {
        return AppResponse.successData(eduBusiEnrollOrderIntegration.appGetById(vo));
    }

}
